Spawning

Spawning is the creation of a thing in a level, particularly during play. In the Doom games in-game significant spawning is present as respawning (where things return to the game), from attacks that spawn missiles, and through the final boss that generates monsters. Other item creations, like dropped items, blood splats and other effects can also be called spawning. Other games based on the Doom engine or source ports may provide additional forms of in-game spawning, such as with scripting (Hexen's ACS, for example).

Monster respawning


When the respawn setting is applied, any monsters that leave corpses behind when defeated and that initially start off in a level (this thus excludes those generated by other things or monsters) which are felled during play respawn at their original starting point. A monster will not spawn if something is occupying its starting location with the exception on Map 30 of any wad of Doom II based wads where anything occupying their starting location would be telefragged upon their respawn including the player even if he is invincible by the means of God Mode or the invulnerability power ups where the normal safeguards of telefragging by monsters is disabled, although it may still spawn later if the location is freed on all the other levels. The respawning happens after a randomized time delay. When a monster respawns, its corpse is whisked away with a teleport flash while another teleport flash marks the arrival of its new incarnation or replacement. Respawned monsters that had been targeting the player before death instantly become alert and move towards their target, but those who had been targeting other monsters or players that are dead are spawned in a nonactive state. The respawn setting can be applied with any skill level using the parameter in the command line, but it will always be used when the "Nightmare!" skill level is chosen.

Technical
The algorithm for respawning a Doom enemy is called every tic and proceeds roughly as follows: Therefore, after 12 seconds have passed, a dead enemy has approximately a 35 / 32 * 6 / 256 = 2.6% chance of respawning in a given second. By treating the chance of respawning as a, it can be calculated that the respawn time is approximately 38 seconds, and the  respawn time is approximately 50 seconds.
 * Has at least 12 seconds elapsed since the enemy's death? If not, do not respawn. This time period is increased to 16 seconds in Strife.
 * Is the current global level time a multiple of 32 tics? If not, do not respawn.
 * Choose a random number from 0 to 255. Is it less than or equal to 4? If so, respawn.

Beginning with v1.666 of Doom and Doom II, lost souls do not respawn because they are not considered monsters by the engine.

In Strife, monsters which have the bit flag set will not respawn. This includes most bosses.

Item respawning
In version 1.5 of Doom a v2.0 deathmatch mode was added that allows certain items to respawn after a period in a way similar to monsters respawning (see above), applying a bluish teleportation flash with a unique teleportation noise where the item is respawning. For purposes of game balance, the partial invisibility and invulnerability powerups do not respawn. Items may respawn even if some thing has moved onto their location, and thus a player may stand at the location where an item will return to get it quickly upon its arrival. This setting is applied when the parameter is added.

Strife adds a parameter. If used in concert with, it will cause the types of items queued for respawning to be swapped from the back of the queue to the front, so that the positions of respawning items are effectively randomized, depending on player item collection patterns.

Source ports frequently generalize the option via configuration settings or as part of new multiplayer modes, thus permitting more or fewer items to respawn.

Player respawning
After being killed, any player in a multiplayer game will respawn once a key or button assigned to key_use is pressed by the user controlling that player. During cooperative games the player will respawn at that player's starting location, and during deathmatch games, at a random deathmatch start point. Like with monsters, returning players will arrive in the level with a teleport flash, but player corpses are not immediately removed when the player returns, giving a rough visual cue during play of how many times each player has died. In Doom, Heretic, and Hexen, corpses are placed on a queue which is gradually flushed as players die. This queue does not exist in Strife, as player corpses in that game automatically remove themselves after a set amount of time, even if the player has not respawned yet.

If all deathmatch spots are blocked, the game will attempt to respawn a player at his cooperative mode starting point, so valid deathmatch levels should still include a full set of cooperative starting points. If the points are missing, the "player corpses walking" glitch may result.